package com.example.mapper;

import com.example.domain.Soil;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SoilMapper {

    @Select("select * from wmy.soil")
    List<Soil> getAll();

    @Select("select * from wmy.soil where soil_id = #{soilId}")
    Soil getById(Integer soilId);

    @Insert("insert into wmy.soil (soil_temperature, soil_moisture, soil_ph, soil_updatetime) values (#{soilTemperature}, #{soilMoisture}, #{soilPh}, #{soilUpdatetime})")
    boolean add(Soil soil);

    @Update("update wmy.soil set soil_temperature=#{soilTemperature},soil_moisture=#{soilMoisture},soil_ph=#{soilPh},soil_updatetime=#{soilUpdatetime} where soil_id = #{soilId}")
    boolean update(Soil soil);

    @Delete("delete from wmy.soil where soil_id = #{soilId}")
    boolean delete(Integer soilId);

}
